<template>
	<view class="container">
		<!-- <jc-navbar title="财务管理" @back="back"></jc-navbar> -->
		<!-- 通知栏 -->
		<!-- <view class="noticeView">
			<u-notice-bar mode='horizontal' speed='100' :list="noticeList"></u-notice-bar>
		</view> -->
		<view class="top" style="padding-top: 30rpx;">
			<view class="headView">
				<view class="otherBalance">
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomes||0}}</text>
						<text class="title">积分余额</text>
					</view>
				</view>
			</view>
		</view>
		
		<view class="main">
			<view class="itemCate">
				<view class="item" @click="operateAction('incomeList', {})">
					<u-image src='/static/mine/incomesList.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">积分余额流水</text>
				</view>
				<!-- <view class="item" @click="operateAction('walletForIncomes', {})">
					<u-image src='/static/mine/dept.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">积分账户</text>
				</view> -->
				<!-- <view class="item" @click="outMoneyListTap">
					<u-image src='/static/mine/outMoneyList.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">提现记录</text>
				</view> -->
				<!-- <view class="item" @click="sendIncomesTap">
					<u-image src='/static/mine/send_incomes.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">积分赠送</text>
				</view>
				<view class="item" @click="sendGoldsTap" v-if="userInfo.openshopModel.isUseGolds">
					<u-image src='/static/mine/send_golds.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">金币赠送</text>
				</view> -->
			</view>
			<view style="margin-top: 60rpx;">
				<jc-button @click='incomesToBalance' title='兑换为余额' width='600' height='88' backgroundColor="#d4a781" ></jc-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {wallet} from '@/api/wallet.js'
	import jcButton from "@/components/jc-button/jc-button.vue"
	export default {
		components:{jcButton},
		data() {
			return {
				page: 1,
				size: 8,
				totalPage: 0,
				walletInfo: {},
				itemList: [],
				noticeList:['通知：近期提现人数较多，到账时间会可能延迟，敬请谅解！'],
				value1: 1,
				value2: 2,
				currentIncomeCate: '',
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.myWallet()
		},
		onPullDownRefresh() {
			this.myWallet()
		},
		methods: {
			back(){
				uni.switchTab({
					url: '/pages/mine/mine'
				})
			},
			incomesToBalance(){
				this.$Router.push({
					name: 'incomesToBalance'
				})
			},
			myWallet() {
				wallet.getWalletInfo().then(res => {
					uni.stopPullDownRefresh();
					if (res.data.code == 10000) {
						this.walletInfo = res.data.data
					}
				})
			},
			operateAction(scene, val) {
				switch (scene) {
					case 'incomeList':
						this.$Router.push({
							name: 'incomeList'
						})
						break;
					case 'walletForIncomes':
						this.$Router.push({
							name: 'walletForIncomes'
						})
						break;
					
					default:
						break;
				}
			},
			
			//积分赠送
			sendIncomesTap(){
				this.$Router.push({
					name: 'sendIncomes',
					params: {
						scene: 'sendIncomes'
					}
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.noticeView{
		// position: fixed;
		// left: 0;
		// top: 0;
		z-index: 10;
	}
	.top{
		width: 750rpx;
		height: 280rpx;
		background-color: #d4a781;
	}
	.main{
		// position: relative;
		// top: -80rpx;
	}
	.headView{
		display: flex;
		flex-direction: column;
		align-items: center;
		background-color: #FFFFFF;
		margin: 0 30rpx;
		padding: 40rpx 0;
		border-radius: 20rpx;
		box-shadow:0 8rpx 16rpx rgba(0, 0, 0, 0.08);
		.totalBalance{
			display: flex;
			flex-direction: column;
			align-items: center;
			.title{
				font-size: 30rpx;
				color: #999999;
			}
			.timeLenght{
				font-size: 50rpx;
				font-weight: bold;
			}
		}
		.otherBalance{
			margin-top: 40rpx;
			width: 100%;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-around;
			.item{
				display: flex;
				flex-direction: column;
				align-items: center;
				.title{
					font-size: 30rpx;
					color: #999999;
				}
				.timeLenght{
					font-size: 34rpx;
					font-weight: bold;
				}
			}
		}
		
	}
	
	.CZTX{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
		margin-top: 20rpx;
	}
	.itemCate{
		display: flex;
		flex-direction: row;
		margin-top: 30rpx;
		flex-wrap: wrap;
		.item{
			margin-left: 30rpx;
			width: 330rpx;
			height: 280rpx;
			background-color: #FFFFFF;
			border-radius: 16rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			margin-bottom: 30rpx;
		}
	}
</style>
